import { useState,useEffect,} from 'react'
import React from "react";
import {Routes,Route,Link,useNavigate} from 'react-router-dom'
import Detail from './Detail'
import User from './User';
import Home from './Home';
function App() {
  const navigate=useNavigate()
  // useEffect(()=>{
  //   // js 跳转 BOM 原始
  //   setTimeout(()=>{
  //     // window.location.href='/post/19999999999999'
  //     navigate('/post/19999999999999')
  //   },2000)
  // },[])
  return (
    <div className="App">
      <nav>
        <Link to='/post?id=19999999999998'>文章</Link>
        <Link to='/post/19999999999999'>文章</Link>
        <Link to='/user'>用户</Link>
      </nav>
      <Routes>
        <Route path='/' element={<Home/>}></Route>
        <Route path='/post' element={<Detail/>}></Route>
        <Route path='/post/:id' element={<Detail/>}></Route>
        <Route path='/user' element={<User/>}></Route>
        {/* 404page 组件 */}
      </Routes>

    </div>
  )
}

export default App
